<script setup lang="ts">
import myUser from "@/composables/myUser.ts";
const {user,getOneUser} = myUser();
const route = useRoute();
const u_id = route.params?.u_id;
await(getOneUser(u_id));
// const change = async ()=>{
//   await switchFreeze(u_id,user.value?.is_freeze);
//   await getOneUser(u_id)
// }
</script>

<template>
  <main class="user_detail" v-if="user">
    <el-card shadow="hover">
      <template #header>

      </template>
      <el-form  label-width="auto" style="max-width: 600px">
        <el-form-item label="姓名">
          <el-input v-model="user.name" readonly/>
        </el-form-item>
        <el-form-item label="头像">
          <el-avatar shape="square" :size="80" :src="user.avatar" />
        </el-form-item>
        <el-form-item label="手机">
          <el-input v-model="user.phone" readonly/>
        </el-form-item>
        <el-form-item label="邮箱">
          <el-input v-model="user.email" readonly/>
        </el-form-item>
        <el-form-item label="冻结">
          <el-input v-model="user.is_freeze" readonly />
        </el-form-item>
        <el-form-item>
          <el-button type="success" @click="$router.push({name:'user.index'})">返回</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </main>
</template>

<style lang="scss" scoped>
main.user_detail {

}
</style>